<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登入 - layuiAdmin</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="../layuiadmin/style/login.css" media="all">
</head>
<body onkeydown="keyLogin()" background="../images/login3.jpeg">

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2 style="color: white;letter-spacing: 8px">律师事务管理</h2>
        <p style="color:whitesmoke;">xxx律师事务所后台管理系统</p>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item" >
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"style="margin-top: 5px"></label>
          <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input" style="height:50px;">
        </div>
        <div class="layui-form-item" style="margin-top: 50px">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"style="margin-top:5px"></label>
          <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input" style="height:50px;">
        </div>
        <div class="layui-form-item" style="margin-top: 50px">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" id="btn" style="height:50px;">登 入</button>
        </div>
        <!--<div class="layui-trans layui-form-item layadmin-user-login-other">-->
          <!--<label>社交账号登入</label>-->
          <!--<a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>-->
          <!--<a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>-->
          <!--<a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>-->
        <!--</div>-->
      </div>
    </div>
    
    <div class="layui-trans layadmin-user-login-footer">
      
      <p style="color: white">© 2019 <a href="http://www.xyitpx.com/" target="_blank" style="color: white">sanyang.com</a></p>
    </div>
  </div>
  <script src="../layuiadmin/js/system/jquery.min.js"></script>
  <script src="../layuiadmin/js/system/jquery.cookie.js"></script>
  <script>
   $(function () {
     $("#btn").click(function () {
         var user_name=$("#LAY-user-login-username").val();
         var user_pwd=$("#LAY-user-login-password").val();
        $.post("http://localhost:8080/user/login",
                {"user_name":user_name,"user_pwd":user_pwd},
                function(msg){
                  if(msg.code==200){
                    $.cookie("redisName",msg.redisName);
                    $.cookie("redisId",msg.redisId);
                    $.cookie("role_id",msg.role_id);
                    location.href="index.html";
                  }else{
                    alert("登录失败");
                    location.href="login.html";
                  }
        });
     });
    });
   function keyLogin(){
       console.log(event.keyCode)
       // 13为回车键
       if (event.keyCode==13){
           // 调用登陆按钮或者登陆方法
           $("#btn").click();
       }
   }
  </script>
</body>
</html>